<template>
	<!-- 闪送商家开户 -->
	<view class="flashOpen-main">
		<view class="flashOpen-form">
			<uni-forms ref="baseForm" :modelValue="baseFormData">
				<uni-forms-item label="企业号" required>
					<uni-easyinput v-model="baseFormData.orgcode" placeholder="请输入企业号" />
				</uni-forms-item>
				<uni-forms-item label="用户名" required>
					<uni-easyinput v-model="baseFormData.username" placeholder="请输入用户名" />
				</uni-forms-item>
				<uni-forms-item label="密码" required>
					<uni-easyinput v-model="baseFormData.password" placeholder="请输入密码" type="password" />
				</uni-forms-item>
			</uni-forms>
		</view>
		<view class="flashOpen-sub active" @click="getflashManageBind">提交申请</view>
		<view class="flashOpen-sub" @click="gotoPath">返回首页</view>
	</view>
</template>

<script>
import { storeOpen } from '../../../api/flashManage/index.js';
export default {
	data() {
		return {
			baseFormData: {
				orgcode: '',
				username: '',
				password: '',
				type:"1"
			}
		};
	},
	methods: {
		async getflashManageBind() {
			if (!this.baseFormData.orgcode) {
				return uni.showToast({
					title: '请输入企业号',
					icon: 'none'
				});
			}
			if (!this.baseFormData.username) {
				return uni.showToast({
					title: '请输入用户名',
					icon: 'none'
				});
			}
			if (!this.baseFormData.password) {
				return uni.showToast({
					title: '请输入密码',
					icon: 'none'
				});
			}
			try {
				const resData = await storeOpen(this.baseFormData);
				uni.navigateTo({
					url:'/pages/storeSide/flashStoreEdit/flashStoreEdit'
				})
			} catch (e) {
				throw Error(e);
			}
		},

		gotoPath() {
			uni.switchTab({
				url: '/pages/nationwideDelivery/nationwideDelivery'
			});
		}
	}
};
</script>

<style>
page {
	background-color: #fff;
}
</style>

<style scoped lang="scss">
.flashOpen-main {
	box-sizing: border-box;
	padding: 30rpx;
	.flashOpen-header {
		height: 100rpx;
		line-height: 100rpx;
		color: #444;
		font-size: 32rpx;
		font-weight: bold;
		text-align: center;
		margin-bottom: 30rpx;
	}

	.flashOpen-sub {
		height: 90rpx;
		line-height: 90rpx;
		text-align: center;
		background-color: #f3f3f3;
		color: #444;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		border: 1px #dbdbdb solid;
	}

	.active {
		background-color: rgb(41, 121, 255);
		color: #fff;
		border: none;
	}
}
</style>
